<?php
class Default_Form_add extends Zend_Form{
    protected $_image_path=null;
    public function set_image($image_path)
    {
         
        $this->_image_path=new Zend_Form_Element_Image('image');
        $this->_image_path->setAttribs(array("width"=>100,"height"=>100));
        $this->_image_path->setAttribs(array("src"=>$image_path));
        $this->addElement($this->_image_path);
    }
    public function init()
    {
        $this->setAction('')->setMethod('post');
       $name=new Zend_Form_Element_Text('bk_name');
       
        $name->setRequired('true')
        ->addValidator('NotEmpty')
        ->addFilter('StringToLower')
        ->setRequired(true);
   
        
        $image=new Zend_Form_Element_File('bk_image');
        $image->setMaxFileSize( 2097152 );
        
        $price=new Zend_Form_Element_Text('bk_price');
        $price->setRequired('true')
                ->addValidator('NotEmpty');
        
        $description=new Zend_Form_Element_Textarea('bk_description',array("rows"=>10,"cols"=>40));
        
        
        $author=new Zend_Form_Element_Select('bk_author');
        
        
       
        
        $submit=$this->createElement('submit','submit');
          
          
          
          
          
          /* set form template */
           $this->setDecorators(array(
                          array('viewScript',
                          array('viewScript'=>'add_form.phtml'),
                     )));
                                                    
        $name->removeDecorator('HtmlTag')
             ->removeDecorator('Label');
        $price->removeDecorator('HtmlTag')
             ->removeDecorator('Label');
        $description->removeDecorator('HtmlTag')
             ->removeDecorator('Label');
        $author->removeDecorator('HtmlTag')
             ->removeDecorator('Label');               
             
      
        $this->addElements(array($name,$submit,$image,$price,$description,$author,$this->_image_path));
        
    }
    
    
}